//
//  CXNetworkManager+Extension.swift
//  XinaWeibo
//
//  Created by chenxuan on 2017/4/11.
//  Copyright © 2017年 chenxuan. All rights reserved.
//

import Foundation

extension CXNetworkManager {
    
    func statusList(completion: @escaping (_ list: [[String: AnyObject]]?, _ isSuccess: Bool)->()) {
        
        let urlString = "https://api.weibo.com/2/statuses/home_timeline.json"
        
        tokenRequest(URLString: urlString, parameters: nil) { (json, isSuccess) in
            // 从 json 中获取 statuses 字典数组
            // 如果 as? 失败，result = nil
            // 提示：服务器返回的字典数组，就是按照时间的倒序排序的
            let json = json as AnyObject
            let result = json["statuses"] as? [[String: AnyObject]]
            completion(result, isSuccess)
        }

        
    }
    
    
    
}
 
